﻿namespace ImapComponent.Net.Mail.Imap4
{
    /// <summary>
    /// Represents the status of specified mailbox.
    /// </summary>
    public class MailboxStatus
    {
        #region Fields

        private readonly string mailboxName;
        private readonly string rawMailboxName;
        private readonly int messageCount;
        private readonly int recentCount;
        private readonly int unseenCount;
        private readonly int uidNext;
        private readonly int uidValidity;

        #endregion // Fields

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the MailboxStatus class.
        /// </summary>
        private MailboxStatus(string mailboxName, string rawMailboxName, int messageCount, int recentCount, int unseenCount, int uidNext, int uidValidity)
        {
            this.mailboxName = mailboxName;
            this.rawMailboxName = rawMailboxName;
            this.messageCount = messageCount;
            this.recentCount = recentCount;
            this.unseenCount = unseenCount;
            this.uidNext = uidNext;
            this.uidValidity = uidValidity;
        }

        /// <summary>
        /// Factory method.
        /// </summary>
        public static MailboxStatus CreateMailboxStatus(string mailboxName, string rawMailboxName, int messageCount, int recentCount, int unseenCount, int uidNext, int uidValidity)
        {
            return new MailboxStatus(mailboxName, rawMailboxName, messageCount, recentCount, unseenCount, uidNext, uidValidity);
        }

        #endregion // Constructors

        #region Properties

        /// <summary>
        /// Gets the full name of the mailbox.
        /// </summary>
        public string MailboxName
        {
            get
            {
                return this.mailboxName;
            }
        }

        /// <summary>
        /// Gets the UTF7 encoded name of the mailbox.
        /// </summary>
        public string RawMailboxName
        {
            get
            {
                return this.rawMailboxName;
            }
        }

        /// <summary>
        /// Gets the number of messages in the mailbox.
        /// </summary>
        public int MessageCount
        {
            get
            {
                return this.messageCount;
            }
        }

        /// <summary>
        /// Gets the number of messages with the \Recent flag set.
        /// </summary>
        public int RecentCount
        {
            get
            {
                return this.recentCount;
            }
        }

        /// <summary>
        /// Gets the number of messages which do not have the \Seen flag set.
        /// </summary>
        public int UnseenCount
        {
            get
            {
                return this.unseenCount;
            }
        }

        /// <summary>
        /// Gets the next unique identifier value of the mailbox.
        /// </summary>
        public int UidNext
        {
            get
            {
                return this.uidNext;
            }
        }

        /// <summary>
        /// Gets the unique identifier validity value of the mailbox.
        /// </summary>
        public int UidValidity
        {
            get
            {
                return this.uidValidity;
            }
        }

        #endregion // Properties
    }
}
